package com.aspose.cells;

import java.util.ArrayList;
import java.util.Iterator;

class zbsw extends Title {
   private zbst z;
   private int A;
   private String B;
   private int C;
   private zary D;
   private Color E;
   private WorksheetCollection F;
   boolean l = true;
   boolean m = false;
   boolean n = true;
   boolean o = false;
   int p;
   zbi q;
   boolean r = false;
   boolean s = false;
   byte[] t;
   byte[] u;
   private boolean G;

   zbsw(WorksheetCollection var1, Chart var2) {
      super(var2);
      this.F = var1;
   }

   boolean a() {
      return this.G;
   }

   void j(boolean var1) {
      this.G = var1;
   }

   zbst z() {
      if (this.z == null) {
         this.z = new zbst();
      }

      return this.z;
   }

   void a(Color var1) {
      this.E = var1;
   }

   zary A() {
      if (this.D == null) {
         this.D = new zary();
      }

      return this.D;
   }

   zary B() {
      return this.D;
   }

   void a(int var1) {
      this.C = var1;
   }

   void a(String var1) {
      this.B = var1;
   }

   void n(int var1) {
      this.l = false;
      this.A = var1;
   }

   boolean C() {
      Font var1 = (Font)this.F.z().get(this.h() > 4 ? this.h() - 1 : this.h());
      return zjn.a(var1, this.E);
   }

   void a(LegendEntry var1) {
      if (this.h() != -1) {
         var1.a(this.h());
         var1.a(this.q != null);
         if (!this.C()) {
            var1.getFont().setColor(this.E);
         }
      }

      var1.setBackgroundMode(this.getBackgroundMode());
   }

   void a(ChartFrame var1, boolean var2, boolean var3) {
      var1.b = this.u;
      var1.a(this.z);
      if (this.h() != -1) {
         var1.c(this.h());
         var1.a(this.q != null, this.q);
         if (!this.C()) {
            var1.getFont().setColor(this.E);
         }
      }

      if (!var2) {
         if ((var1.d() != 3 || this.m() <= -2000 || this.n() <= -2000) && var1.d() != 4 && var1.d() != 5 && var1.d() != 7) {
            if (var1.d() != 3) {
               var1.e(this.m());
               var1.f(this.n());
               var1.h(this.p());
               var1.g(this.o());
               var1.e(this.j());
               var1.f(this.k());
               var1.g(this.l());
               if (!var3 && (this.r || this.m() != 0 || this.n() != 0)) {
                  var1.e(false);
                  var1.f(false);
               }
            }
         } else if (this.m() != 0 || this.n() != 0) {
            var1.m(2003);
            var1.i(this.m());
            var1.j(this.n());
            var1.k(this.p());
            var1.l(this.o());
            var1.e(this.j());
            var1.f(this.k());
            var1.g(this.l());
            if (!var3 && (this.r || this.m() != 0 || this.n() != 0)) {
               var1.e(false);
               var1.f(false);
            }
         }
      }

      var1.setBackgroundMode(this.getBackgroundMode());
      if (!this.q()) {
         var1.getArea().a(this.getArea(), (CopyOptions)null);
         var1.getBorder().a(this.getBorder());
         var1.setShadow(this.getShadow());
         var1.h(this.q());
      }
   }

   void a(Legend var1, boolean var2) {
      this.a(var1, var2, true);
      if (this.a != null) {
         var1.a = this.a;
      }

      if (this.u != null) {
         var1.b = this.u;
      }

      if (this.t != null) {
         var1.l = this.t;
      }

   }

   void a(ChartDataTable var1) {
      if (this.h() != -1) {
         var1.a(this.h());
         var1.a(this.q != null);
         if (!this.C()) {
            var1.getFont().setColor(this.E);
         }
      }

      if (!this.q()) {
         var1.getBorder().a(this.getBorder());
         var1.setBackgroundMode(this.getBackgroundMode());
      }
   }

   void a(Title var1) {
      var1.x = this.x;
      var1.getBorder().setVisible(true);
      var1.getBorder().b(true);
      var1.getArea().setFormatting(0);
      this.a(var1, false, false);
      var1.a(this.z);
      var1.g(true);
      if ((this.p & '\uffff' & 64) != 0) {
         var1.b((String)null);
      } else {
         var1.b(this.getText());
         var1.k(false);
         var1.setAutoText((this.p & '\uffff' & 16) != 0);
      }

      var1.l(this.F());
      var1.setTextDirection(this.getTextDirection());
      var1.setTextHorizontalAlignment(this.getTextHorizontalAlignment());
      var1.setTextVerticalAlignment(this.getTextVerticalAlignment());
      if (!this.o) {
         var1.setRotationAngle(this.getRotationAngle());
      }

      if (this.D() != null) {
         var1.a(this.D());
      }

      if (!this.s) {
         var1.getBorder().setVisible(false);
         var1.getArea().setFormatting(1);
      }

   }

   void a(Axis var1, DisplayUnitLabel var2, ArrayList var3) {
      this.a(var2, false, false);
      var2.setText(this.getText());
      if ((this.p & '\uffff' & 64) != 0) {
         var1.b(false);
      }

      var2.l = this.x;
      var2.j(this.F());
      var2.setTextDirection(this.getTextDirection());
      var2.setTextHorizontalAlignment(this.getTextHorizontalAlignment());
      var2.setTextVerticalAlignment(this.getTextVerticalAlignment());
      if (!this.o) {
         var2.setRotationAngle(this.getRotationAngle());
      }

   }

   void a(Chart var1, boolean var2) {
      if (var2) {
         switch(this.A().a) {
         case 2:
            this.a(var1.getSecondValueAxis().getTitle());
            break;
         case 3:
            this.a(var1.getSecondCategoryAxis().getTitle());
         }
      } else {
         switch(this.A().a) {
         case 2:
            this.a(var1.getValueAxis().getTitle());
            break;
         case 3:
            this.a(var1.getCategoryAxis().getTitle());
            break;
         case 7:
            this.a(var1.getSeriesAxis().getTitle());
         }
      }

   }

   void a(Chart var1, ArrayList var2, ArrayList var3) {
      int var4 = var1.getType();
      boolean var5 = false;
      DataLabels var6 = null;
      int var7 = -1;
      if ((this.A().b & '\uffff') < var2.size()) {
         zhr var8 = (zhr)var2.get(this.A().b & '\uffff');
         if (var8 != null) {
            if (var8.b == 0) {
               Series var9 = (Series)var8.a;
               var4 = var9.getType();
               var5 = true;
               if (this.A().c == 65535) {
                  var7 = this.A().b & '\uffff';
                  var6 = var9.getDataLabels();
               } else {
                  ChartPoint var10 = var9.getPoints().a(this.A().c & '\uffff');
                  var6 = var10.getDataLabels();
               }
            } else {
               if (var8.b != 1) {
                  return;
               }

               Trendline var11 = (Trendline)var8.a;
               var6 = var11.getDataLabels();
            }
         }

         var6.l = this.t;
         this.a(var6, false, false);
         var6.a(this.w);
         if (this.x != null) {
            var6.n = zin.a(var1.j(), var1.getWorksheet());
            var6.n.a(this.x);
         }

         var6.setAutoText((this.p & '\uffff' & 16) != 0);
         var6.setDeleted((this.p & '\uffff' & 64) != 0);
         var6.a(this.D());
         var6.j(this.F());
         var6.setTextDirection(this.getTextDirection());
         var6.setTextHorizontalAlignment(this.getTextHorizontalAlignment());
         var6.setTextVerticalAlignment(this.getTextVerticalAlignment());
         if (!this.o) {
            var6.setRotationAngle(this.getRotationAngle());
         }

         if (!this.l) {
            boolean var12 = false;
            if (this.A != 9 && var5) {
               switch(this.A) {
               case 3:
                  switch(var4) {
                  case 7:
                  case 8:
                  case 15:
                  case 16:
                     var6.n(0);
                     var12 = true;
                  case 9:
                  case 10:
                  case 11:
                  case 12:
                  case 13:
                  case 14:
                  }
               }
            }

            if (!var12) {
               var6.n(this.A);
            }
         }

         var6.setNumberFormatLinked(this.n);
         if (!this.n) {
            if (this.B != null && !"".equals(this.B)) {
               var6.c(this.B);
            } else {
               var6.a(this.C);
            }
         }

         var6.l(this.m);
         if (this.A().d) {
            byte var13 = this.A().e;
            if (var13 == 0) {
               var6.a((int)1, (this.p & '\uffff' & 4) != 0);
               var6.a((int)2, (this.p & '\uffff' & 4096) != 0);
               var6.a((int)4, (this.p & '\uffff' & 8192) != 0);
               var6.a((int)3, (this.p & '\uffff' & 16384) != 0);
            } else {
               var6.a((int)5, (var13 & 255 & 1) != 0);
               var6.a((int)3, (var13 & 255 & 2) != 0);
               var6.a((int)1, (var13 & 255 & 4) != 0);
               var6.a((int)2, (var13 & 255 & 8) != 0);
               var6.a((int)4, (var13 & 255 & 16) != 0);
            }

            var6.setSeparatorValue(this.A().f);
         } else if (var6.q) {
            var6.a((int)1, (this.p & '\uffff' & 4) != 0);
            var6.a((int)2, (this.p & '\uffff' & 4096) != 0);
            var6.a((int)4, (this.p & '\uffff' & 8192) != 0);
            if (ChartCollection.p(var4)) {
               var6.a((int)5, (this.p & '\uffff' & 16384) != 0);
               var6.a((int)3, false);
            } else {
               var6.a((int)3, (this.p & '\uffff' & 16384) != 0);
            }
         } else {
            var6.a((int)1, (this.p & '\uffff' & 4) != 0);
            var6.a((int)2, (this.p & '\uffff' & 4096) != 0);
            var6.a((int)4, (this.p & '\uffff' & 8192) != 0);
            var6.a((int)3, (this.p & '\uffff' & 16384) != 0);
         }

         if (var7 != -1) {
            this.b(var6, var7, var3);
         }

      }
   }

   void a(DataLabels var1, int var2, ArrayList var3) {
      this.a(var1, false, false);
      var1.a(this.getText());
      var1.setAutoText((this.p & '\uffff' & 16) != 0);
      var1.j(this.F());
      var1.setTextDirection(this.getTextDirection());
      var1.setTextHorizontalAlignment(this.getTextHorizontalAlignment());
      var1.setTextVerticalAlignment(this.getTextVerticalAlignment());
      if (!this.o) {
         var1.setRotationAngle(this.getRotationAngle());
      }

      if (!this.l) {
         var1.n(this.A);
      }

      var1.setNumberFormatLinked(this.n);
      if (!this.n) {
         if (this.B != null && !"".equals(this.B)) {
            var1.setNumberFormat(this.B);
         } else {
            var1.a(this.C);
         }
      }

      var1.setShowLegendKey(this.m);
      if (this.A().d) {
         byte var4 = this.A().e;
         var1.setShowSeriesName((var4 & 255 & 1) != 0);
         var1.setShowCategoryName((var4 & 255 & 2) != 0);
         var1.setShowValue((var4 & 255 & 4) != 0);
         var1.setShowPercentage((var4 & 255 & 8) != 0);
         var1.setShowBubbleSize((var4 & 255 & 16) != 0);
         if (this.A().f != null) {
            switch(this.A().f.charAt(0)) {
            case '\n':
               var1.setSeparator(5);
               break;
            case ' ':
               var1.setSeparator(1);
               break;
            case ',':
               var1.setSeparator(2);
               break;
            case '.':
               var1.setSeparator(4);
               break;
            case ';':
               var1.setSeparator(3);
            }
         }
      } else if (var1.q) {
         var1.setShowValue((this.p & '\uffff' & 4) != 0);
         var1.setShowPercentage((this.p & '\uffff' & 4096) != 0);
         var1.setShowBubbleSize((this.p & '\uffff' & 8192) != 0);
         var1.setShowCategoryName((this.p & '\uffff' & 16384) != 0);
      }

      if (var2 != -1) {
         this.b(var1, var2, var3);
      }

   }

   void b(DataLabels var1, int var2, ArrayList var3) {
      Series var4 = (Series)var1.L();
      if (var4.b() != null) {
         ArrayList var5 = new ArrayList();
         zary var6 = null;
         int var7;
         if (var3 != null) {
            for(var7 = var3.size() - 1; var7 >= 0; --var7) {
               var6 = (zary)var3.get(var7);
               if ((var6.b & '\uffff') == var2 && (var6.c & '\uffff') != 65535) {
                  com.aspose.cells.b.a.a.ze.a(var5, (Object)var6.c);
               }
            }
         }

         if (var5.size() == 0) {
            for(var7 = 0; var7 < var4.getPoints().a(); ++var7) {
               DataLabels var8 = var4.getPoints().c(var7).j();
               if (var8 != null) {
                  this.a(var1, var8);
               }
            }
         } else {
            boolean var13 = true;

            for(int var14 = 0; var14 < var4.getPoints().a(); ++var14) {
               ChartPoint var9 = var4.getPoints().c(var14);
               DataLabels var10 = var9.j();
               if (var10 != null) {
                  var13 = true;
                  Iterator var11 = var5.iterator();

                  while(var11.hasNext()) {
                     int var12 = (Integer)var11.next();
                     if ((var12 & '\uffff') == var9.a) {
                        var13 = false;
                        break;
                     }
                  }

                  if (var13) {
                     this.a(var1, var10);
                  }
               }
            }
         }

      }
   }

   void a(DataLabels var1, DataLabels var2) {
      Object var3 = null;
      var2.a(var1.getAutoScaleFont(), (zbi)null);
      var2.d(var1.getBackgroundMode());
      var2.h(var1.q());
      var2.getBorder().a(var1.getBorder());
      var2.getArea().a(var1.getArea(), (CopyOptions)var3);
      var2.c(var1.h());
      if (var1.D() != null) {
         var2.getFont().c(var1.D());
      }

      var2.m(var1.getNumberFormatLinked());
      if (!var1.getNumberFormatLinked()) {
         if (var1.getNumberFormat() != null && !"".equals(var1.getNumberFormat())) {
            var2.c(var1.getNumberFormat());
         } else {
            var2.a(var1.getNumber());
         }
      }

      var2.setRotationAngle(var1.getRotationAngle());
      var2.setTextHorizontalAlignment(var1.getTextHorizontalAlignment());
      var2.setTextVerticalAlignment(var1.getTextVerticalAlignment());
      var2.setTextDirection(var1.getTextDirection());
      if (var1.q && var1.q) {
         if (var1.getShowValue()) {
            var2.setShowValue(true);
         }

         if (var1.getShowPercentage()) {
            var2.setShowPercentage(true);
         }

         if (var1.getShowCategoryName()) {
            var2.setShowCategoryName(true);
         }
      }

   }
}
